//
//  SharedMemory.h
//  ClienteHabitueIOS
//
//  Created by Mauro Carreño on 5/29/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
#import "TopBarViewController.h"

@class PointOfSell;
@class User;
@class AuditType;


@interface SharedMemory : NSObject{
    
    
    NSString* errorMessage;
    NSString* errorMessageTitle;
    
    NSString* commitPointOfSellInternalId;
    int userIndex;
    int pointOfSellIndex;
    int auditTypeIndex;
    PointOfSell* mNewPointOfSell;
	NSMutableArray* pointsOfSell;
	NSMutableArray* auditTypes;
	NSMutableArray* users;
	NSMutableArray* auditTypesDone;
    NSString* documentsPath;
    CLLocation* lastGoodLocation;

}

@property (nonatomic, retain) NSString *errorMessage;
@property (nonatomic, retain) NSString *errorMessageTitle;

@property (nonatomic, retain) NSString* commitPointOfSellInternalId;
@property (nonatomic, assign) int userIndex;
@property (nonatomic, assign) int pointOfSellIndex;
@property (nonatomic, assign) int auditTypeIndex;
@property (nonatomic, retain) PointOfSell* mNewPointOfSell;
@property (nonatomic, retain) NSMutableArray* pointsOfSell;
@property (nonatomic, retain) NSMutableArray* auditTypes;
@property (nonatomic, retain) NSMutableArray* users;
@property (nonatomic, retain) NSMutableArray* auditTypesDone;
@property (nonatomic, retain) NSString* documentsPath;
@property (nonatomic, retain) CLLocation* lastGoodLocation;

+ (id)sharedInstance;

- (User*) getUser;
- (PointOfSell*) getPointOfSell;
- (AuditType*) getAuditType;
+ (AuditType*) findAuditTypeByExternalId:(NSString*) externalId;
+ (PointOfSell*) findPDVByInternalId:(NSString*) internalIdPDV;
+ (NSString*)getDocumentsDir;
+ (void) fillPathNamesArraysWithPathNamesPDVs:(NSMutableArray*) pathNamesPDVs pathNamesAudits:(NSMutableArray*) pathNamesAudits;
+ (void) deleteAllFilesForPDVs:(bool) deletePDVs forAudits:(bool) deleteAudits;
+ (void) deleteListOfNames:(NSArray*) listOfNames;
+ (void) deletePathName:(NSString*) _name;
+ (void) showError:(NSString *)title andText:(NSString *) desc;
+ (void) createTextFile:(NSString*)fileName data:(NSString*)data;
+ (void) createDirectory:(NSString *)directoryName;
+ (void) createTextFileFullPath:(NSString*)filePath data:(NSString*)data;
- (void) resetAuditTypesDone;
- (NSString*) makeOwnPDVnTypeId;
- (NSString*) makePDVnTypeId:(PointOfSell*)pdv auditType:(AuditType*)auditType;
- (NSString*) makeOwnPDVnId;
- (NSString*) makePDVnId:(PointOfSell*)pdv;
//+ (bool) valueContainedInDictionary:(NSDictionary*)_dictionary value:(NSString*)_value;
- (bool) isOlderThanAMonth:(NSString*) dateString;
- (void) rememberStringOn:(NSString*) defaultsDicKey key:(NSString*) key value:(NSString*) value;
+ (void) rememberTodayOn:(NSString*) key;
- (void) forgetKeyOn:(NSString*) defaultsDicKey key:(NSString*) key;
+ (void) forgetAllKeysOn:(NSString*) defaultsDicKey;


@end
